<#assign base=request.contextPath />
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>固沙后台管理系统登录</title>

    <!-- Bootstrap -->
    <link href="${base}/static/vendors/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="${base}/static/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- Animate.css -->
    <link href="${base}/static/vendors/animate.css/animate.min.css" rel="stylesheet">
    <!-- sweetalert css -->
    <link href="${base}/static/vendors/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="${base}/static/build/css/custom.min.css" rel="stylesheet">
  </head>

  <body class="login">
    <div>
      <a class="hiddenanchor" id="signup"></a>
      <a class="hiddenanchor" id="signin"></a>

      <div class="login_wrapper">
        <div class="animate form login_form">
          <section class="login_content">
            <form>
              <h1>固沙后台管理系统登录</h1>
              <div>
                <input type="text" id="userName" class="form-control" placeholder="请输入用户名" />
              </div>
              <div>
                <input type="password" id="password" class="form-control" placeholder="请输入密码"/>
              </div>
              <div>
                <a class="btn btn-default submit">登录</a>
              </div>

              <div class="clearfix"></div>

              <div class="separator">
                <div class="clearfix"></div>
                <br />
                <div>
                  <h1><i class="fa fa-paw"></i> 固沙 !</h1>
                  <p>©2018 All Rights Reserved. GuSha!</p>
                </div>
              </div>
            </form>
          </section>
        </div>
      </div>
    </div>
    <!-- jQuery -->
    <script src="${base}/static/vendors/jquery/dist/jquery.min.js"></script>
    <!-- sweetalert -->
    <script src="${base}/static/vendors/sweetalert/sweetalert.min.js"></script>
    <!-- layer -->
    <script src="${base}/static/vendors/layer/layer.js"></script>
    <script type="text/javascript">
    	$(".submit").click(function(){
    		var userName = $("#userName").val();
    		var password = $("#password").val();
    		if($.trim(userName)==""){
    			swal("请输入用户名！","","error");
    			return;
    		}
			if($.trim(password)==""){
				swal("请输入密码！","","error");
    			return;
    		}
			$.post("${base}/doLogin", {userName: userName, password: password},
				function(data){
				if(data.flag){
					window.location.href="${base}/gx/main";
				}else{
					swal(data.msg,"","error");
				}
			});
    	});
    	
    	$(document).ajaxComplete(function(event,data,settings){  
    		layer.closeAll('loading');
       	});
    	
    	$(document).ajaxStart(function(){  
    		layer.load();
       	});
    	
    	document.onkeydown=keyDownSearch;  
    	function keyDownSearch(e) {  
    	    // 兼容FF和IE和Opera    
    	    var theEvent = e || window.event;    
    	    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;    
    	    if (code == 13) {  
    	    	$(".submit").click();   
    	        return false;    
    	    }    
    	    return true;    
    	}  
    </script>
  </body>
</html>